<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2021/12/6
 * Time: 21:07
 */
if (empty($_POST['user'])){
    echo '用户名为必填项';
    echo '<br/>';
    echo '<a href="login.php">返回登录</a>';
    die;
}
else{
    $user = $_POST['user'];
}

if (empty($_POST['password'])){
    echo '请填写密码';
    echo '<br/>';
    echo '<a href="login.php">返回登录</a>';
    die;
}
else{
    $password = $_POST['password'];
}

if ($user == 'admin' && $password == '888888' ){
    $md5 = md5($user.$password.time());
    //echo '设置COOKIES';
    setcookie('Token',$md5,time()+24*3600);
    echo '<a href="cookies.php"><input type="submit" value="上传头像"></a>';
}
else{
    echo '用户名或密码错误！';
    echo '<br/>';
    echo '<a href="login.php">返回登录</a>';
    die;
}